<template>
  <el-dialog
    :visible.sync="visible"
    title="核销记录"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    top="70px"
  >
    <el-form :model="dataForm" ref="dataForm" label-width="100px">
      <el-row :gutter="30">
        <el-col :span="12">
          <el-form-item label="发船信息:">
            <p class="txt">{{dataForm.orderEntity.playDate}} {{dataForm.orderEntity.playTime}}/{{orderType[dataForm.orderEntity.orderType]}}/{{dataForm.orderEntity.boatNo}}</p>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="上船时间:">
            <p class="txt">{{dataForm.orderEntity.updateDate}}</p>
          </el-form-item>
        </el-col>
         <el-col :span="12">
          <el-form-item label="渔船号:">
            <p class="txt">{{dataForm.orderEntity.boatCode}}</p>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="订单编号:">
            <p class="txt">{{ dataForm.orderEntity.orderCode }}</p>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="出游时间:">
            <p class="txt">{{ dataForm.orderEntity.playLength }}小时</p>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12" style="padding-left:45px">
          <h4>预约人员信息</h4>
          <div class="item person_item" v-for="(book,index) in dataForm.bookList" :key="index">
            <span>{{book.touristName}}</span>
            <span>身份证 {{book.touristCode}}</span>
            <span>{{typeCfg[book.remark]}}</span>
          </div>
        </el-col>
        <el-col :span="12">
          <h4>实际上船人员信息</h4>
          <div class="item person_item" v-for="(book,index) in dataForm.boardingList" :key="index">
            <span>{{book.touristName}}</span>
            <span>身份证 {{book.touristCode}}</span>
            <span>{{typeCfg[book.remark]}}</span>
          </div>
        </el-col>
      </el-row>
    </el-form>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      dataForm: {
        id: "",
        comments: [],
        pics: [],
      },
			typeCfg:{'book':'预订单','scene':'现场单'},
      orderType:{
        1:'特价',
        2:'包船',
        3:'拼船'
      },
    };
  },
  computed: {},
  methods: {
    init() {
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.getInfo();
        }
      });
    },
    // 获取信息
    getInfo() {
      this.$http
        .get("/scenic/order/writeOffRecordInfo/" + this.dataForm.id)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          this.dataForm = {
            ...this.dataForm,
            ...res.data,
          };
          this.dataForm.bookList.forEach(l=>{
							l.touristCode = l.touristCode.replace(/^(.{6})(?:\d+)(.{4})$/, '\$1******\$2');
						})
						this.dataForm.boardingList.forEach(l=>{
							l.touristCode = l.touristCode.replace(/^(.{6})(?:\d+)(.{4})$/, '\$1******\$2');
						})
        })
        .catch(() => {});
    },
  },
};
</script>

<style lang="scss" scoped>
.person_item{
  span{
    margin-left: 10px;
    &:first-child{
      margin-left: 0;
    }
  }
  margin-top: 20px;
}

.txt {
  line-height: 40px;
  height: auto;
  margin: 0;
  padding: 0;

  &.content {
    ::v-deep p {
      padding: 0;
      line-height: 24px;
      margin: 0 !important;
    }
    ::v-deep img {
      width: 100%;
    }

    img {
      width: 100%;
    }
  }
}
</style>
